package spark.example

import org.apache.spark._
import SparkContext._

object Test_reduceByKey {
    def main(args: Array[String]) {
        val conf = new SparkConf().setAppName("TEST")

        val sc = new SparkContext(conf)
        val a = List((1,3),(1,2),(2,4),(3,5),(4,6),(1,6))
	val inputRDD = sc.parallelize(a)
	inputRDD.reduceByKey(sum).collect().foreach(println(_))
    }
    def sum( a:Int, b:Int) : Int = {
	var sum:Int = 0
	sum = a + b
	return sum
    }
}
